// https://leetcode.cn/problems/number-of-rectangles-that-can-form-the-largest-square/description/


func countGoodRectangles(rectangles [][]int) int {
    c := make(map[int]int)
	max_e := 0
	for _, v := range rectangles {
		x, y := v
		e = min(x, y)
		c[e]++
		if c[e] > max_e {
			max_e = c[e]
		}
	}
	ans := 0
	for _, v := range c {
		if v == max_e {
			ans++
		}
	}
	return ans
}